<script setup lang="ts">
import HeaderView from "@/components/layout/HeaderLayout.vue";
import BodyView from "@/components/layout/BodyLayout.vue";
import SlideView from "@/components/layout/SlideLayout.vue";
import {ref} from "vue";
import {listen} from "@tauri-apps/api/event";
import {appWindow} from "@tauri-apps/api/window";

const isMaximized = ref(false)

//监视窗体最大化和还原状态，修改对应图标
listen('tauri://resize', async () => {
  isMaximized.value = await appWindow.isMaximized()
  console.log(isMaximized.value)
})

</script>

<template>
  <div class="flaycat-content-root">
    <div class="header-layout">
      <HeaderView :isMaximized="isMaximized" />
    </div>
    <div class="body-root tw-flex-1" :class="isMaximized ? 'body-root-fullscreen' : 'body-root-normal'">
      <div class="slide-layout tw-bg-transparent">
        <SlideView/>
      </div>
      <div class="body-content">
        <BodyView/>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">

//$border-radius: 8px;
//$border-header-style: 1px solid #808080FF;
@import "@/assets/styles/_variables.scss";

.flaycat-content-root {
  @apply tw-h-full tw-w-full tw-flex tw-flex-col tw-bg-transparent;
}

.body-root {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  background-color: transparent;
  overflow: hidden;
  border-right: $border-header-style;
  border-bottom: $border-header-style;
  border-left: $border-header-style;

  //transition: border-color 0.25s;
  //box-shadow: 0 2px 2px red;
}

.body-root-fullscreen {
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.body-root-normal {
  border-bottom-right-radius: $border-radius;
  border-bottom-left-radius: $border-radius;
}

.body-content {
  @apply tw-flex-1 tw-bg-neutral-700;
}

.header-layout {
  height: 30px;
}

</style>
